package com.personal.utils;
import com.personal.pojo.TApply;
import com.personal.pojo.TCourse;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class GetAWeekCourse {
    public Map getAWeek(List<TApply> list){
        //传过来的apply是用户报名的所有课程
        //将课程存到map中，map<String,TCourse> map<"11",TCourse> 代表星期一第一节课，前端if判断是第几节课的
        Map<String,TCourse> map = new HashMap<>();
        list.forEach(apply -> {
            //获取报名表中的课程
            TCourse course = apply.getCourse();
            //获取星期几
            String strWeek = String.valueOf(apply.getCourse().getWeek());
            //获取第几节课
            String strSection = String.valueOf(apply.getCourse().getSection().getSectionid());
            //存入map中
            String str = strWeek+strSection;
            map.put(str,course);
        });
        return map;
    }
}
